import http from "@/core/http";
import { HTTP_HEADERS_CONTENT_TYPE } from "@/core/http.config";
import API_CONFIG, { IAxiosResultProps } from "@/core/api";
import { AnyObject } from "@/types";

/** http请求示例 */
export async function getRequest(params: AnyObject) {
  const { code, data } = await http.get<IAxiosResultProps<string>>(
    API_CONFIG.MAIN.GET_INDEX,
    params,
    HTTP_HEADERS_CONTENT_TYPE.JSON,
  );
  return Promise.resolve(code === 200 ? data : "");
}
